/**
 *
 */
package com.angel.io.descriptor;

import java.text.DateFormat;
import java.util.Date;

import com.angel.io.log.ProcessorLog;
import com.angel.io.separator.ColumnSeparator;

/**
 * @author William
 *
 */
public class FileProcessorDescriptor {

	private static final String DEFAULT_NAME = "File Processor Descriptor";
	private ColumnSeparator columnSeparator;
	private String name;
	private ProcessorLog processorLog;
	private Boolean hasHeader;

	public FileProcessorDescriptor(){
		this(DEFAULT_NAME);
	}
	/** Create a new instance object for {@link FileProcessorDescriptor} with a specific name, and
	 * a comma column separator.
	 *
	 * @param name for file processor descriptor.
	 * @see ColumnSeparator
	 */
	public FileProcessorDescriptor(String name){
		super();
		this.name = name;
		this.processorLog = new ProcessorLog(name);
		this.hasHeader = true;
		this.columnSeparator = ColumnSeparator.COMMA;
	}

	public FileProcessorDescriptor(String name, ColumnSeparator columnSeparator){
		super();
		this.name = name;
		this.processorLog = new ProcessorLog(name);
		this.hasHeader = true;
		this.columnSeparator = columnSeparator;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the processorLog
	 */
	public ProcessorLog getProcessorLog() {
		return processorLog;
	}

	/**
	 * @param processorLog the processorLog to set
	 */
	public void setProcessorLog(ProcessorLog processorLog) {
		this.processorLog = processorLog;
	}

	/**
	 * @return the hasHeader
	 */
	public Boolean getHasHeader() {
		return hasHeader;
	}

	/**
	 * @param hasHeader the hasHeader to set
	 */
	public void setHasHeader(Boolean hasHeader) {
		this.hasHeader = hasHeader;
	}

	/**
	 * @return the columnSeparator
	 */
	public ColumnSeparator getColumnSeparator() {
		return columnSeparator;
	}

	/**
	 * @param columnSeparator the columnSeparator to set
	 */
	public void setColumnSeparator(ColumnSeparator columnSeparator) {
		this.columnSeparator = columnSeparator;
	}

	public String getColumnSeparatorValue(){
		return this.columnSeparator.getValue();
	}

	public String buildFileName(){
		String fileName = this.getName() + " - " + DateFormat.getDateInstance(DateFormat.MEDIUM).format(new Date());
		return fileName;
	}
}
